package com.ehotting.edsta.diagnosisPredict.feign;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.AlgoVersionFile;
import com.ehotting.edsta.diagnosisPredict.feign.factory.AlgoVersionFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

/**
 * 轻量化算法参数历史版本feignClient
 */
@FeignClient(name = "AlgoVersionFile", url = "${request.url.prefix}/algoVersionFile",
        fallbackFactory = AlgoVersionFileFallbackFactory.class)
public interface AlgoVersionFileFeignService {

    @GetMapping("/pageList")
    Response<PageDto<AlgoVersionFile>> pageList(@RequestParam("counts") Integer counts,
                                                @RequestParam("fileAlias") String fileAlias,
                                                @RequestParam("fileName") String fileName,
                                                @RequestParam("fileSize") String fileSize,
                                                @RequestParam("fileUrl") String fileUrl,
                                                @RequestParam("id") Integer id,
                                                @RequestParam("templateId") Integer templateId,
                                                @RequestParam("updateTime") Date updateTime,
                                                @RequestParam("version") String version);

    @PostMapping("/deleteByIds")
    Response<String> deleteByIds(String ids);

    @GetMapping("/getById")
    Response<AlgoVersionFile> getById(Long id);

    @PostMapping("/upload")
    Response<AlgoVersionFile> upload(@RequestParam("file") MultipartFile file,
                                     @RequestParam("id") Long id,
                                     @RequestParam("templateId") Long templateId,
                                     @RequestParam("version") String version);

    @PostMapping("/download")
    feign.Response download(@RequestParam("id") Long id);

}